HAL I2C types migration ¶
This section provides information about the HAL I2C types migration.
HAL I2C state type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_I2C_STATE_RESET,
HAL_I2C_STATE_READY,
HAL_I2C_STATE_BUSY,
HAL_I2C_STATE_BUSY_TX,
HAL_I2C_STATE_BUSY_RX,
HAL_I2C_STATE_LISTEN,
HAL_I2C_STATE_BUSY_TX_LISTEN,
HAL_I2C_STATE_BUSY_RX_LISTEN,
HAL_I2C_STATE_ABORT,
HAL_I2C_STATE_ERROR,
HAL_I2C_STATE_TIMEOUT
} HAL_I2C_StateTypeDef;
|
typedef enum
{
HAL_I2C_STATE_RESET,
HAL_I2C_STATE_INIT,
HAL_I2C_STATE_IDLE,
HAL_I2C_STATE_TX,
HAL_I2C_STATE_RX,
HAL_I2C_STATE_LISTEN,
HAL_I2C_STATE_TX_LISTEN,
HAL_I2C_STATE_RX_LISTEN,
HAL_I2C_STATE_ABORT
} hal_i2c_state_t;
|
Related concept: Revised and optimized HAL state machine
HAL I2C mode type definition ¶
Change the name of a member.
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_I2C_MODE_NONE,
HAL_I2C_MODE_MASTER,
HAL_I2C_MODE_SLAVE,
HAL_I2C_MODE_MEM
} HAL_I2C_ModeTypeDef;
|
typedef enum
{
HAL_I2C_MODE_NONE,
HAL_I2C_MODE_MASTER,
HAL_I2C_MODE_SLAVE,
HAL_I2C_MODE_MASTER_MEM
} hal_i2c_mode_t;
|
HAL I2C callback ID type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef enum
{
HAL_I2C_MASTER_TX_COMPLETE_CB_ID,
HAL_I2C_MASTER_RX_COMPLETE_CB_ID,
HAL_I2C_SLAVE_TX_COMPLETE_CB_ID,
HAL_I2C_SLAVE_RX_COMPLETE_CB_ID,
HAL_I2C_LISTEN_COMPLETE_CB_ID,
HAL_I2C_MEM_TX_COMPLETE_CB_ID,
HAL_I2C_MEM_RX_COMPLETE_CB_ID,
HAL_I2C_ERROR_CB_ID,
HAL_I2C_ABORT_CB_ID,
HAL_I2C_MSPINIT_CB_ID,
HAL_I2C_MSPDEINIT_CB_ID
} HAL_I2C_CallbackIDTypeDef;
|
Removed. Note The callback registration in HAL2 is handled by specific functions for each I2C event. These functions are used to register callback functions for different I2C events. See HAL I2C callbacks register and unregister functions for more details. |
Related concept: Individual callback registration APIs replace global register and unregister functions
HAL I2C configuration type definition ¶
The
hal_i2c_config_t
structure is simplified to include only the essential parameters, with additional configurations handled by separate functions.
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t Timing;
uint32_t OwnAddress1;
uint32_t AddressingMode;
uint32_t DualAddressMode;
uint32_t OwnAddress2;
uint32_t OwnAddress2Masks;
uint32_t GeneralCallMode;
uint32_t NoStretchMode;
} I2C_InitTypeDef;
|
typedef struct
{
uint32_t timing;
uint32_t own_address1;
hal_i2c_addressing_mode_t addressing_mode;
} hal_i2c_config_t;
hal_status_t HAL_I2C_SetConfigOwnAddress2(hal_i2c_handle_t *hi2c,
uint32_t addr,
hal_i2c_own_addr2_mask_t mask);
hal_status_t HAL_I2C_EnableOwnAddress2(hal_i2c_handle_t *hi2c);
hal_status_t HAL_I2C_DisableOwnAddress2(hal_i2c_handle_t *hi2c);
hal_i2c_own_addr2_status_t HAL_I2C_IsEnabledOwnAddress2(const hal_i2c_handle_t *hi2c);
hal_status_t HAL_I2C_SLAVE_EnableAckGeneralCall(hal_i2c_handle_t *hi2c);
hal_status_t HAL_I2C_SLAVE_DisableAckGeneralCall(hal_i2c_handle_t *hi2c);
hal_i2c_slave_ack_general_call_status_t HAL_I2C_SLAVE_IsEnabledAckGeneralCall(const hal_i2c_handle_t *hi2c);
hal_status_t HAL_I2C_SLAVE_EnableClockStretching(hal_i2c_handle_t *hi2c);
hal_status_t HAL_I2C_SLAVE_DisableClockStretching(hal_i2c_handle_t *hi2c);
hal_i2c_slave_stretch_mode_status_t HAL_I2C_SLAVE_IsEnabledClockStretching(const hal_i2c_handle_t *hi2c);
|
Related concept: Removal and conversion of init structure to configuration structure
HAL I2C handle type definition ¶
|
HAL1 |
HAL2 |
|---|---|
I2C_HandleTypeDef
|
hal_i2c_handle_t
|
Related concepts:
HAL I2C autonomous mode configuration type definition ¶
|
HAL1 |
HAL2 |
|---|---|
typedef struct
{
uint32_t TriggerState;
uint32_t TriggerSelection;
uint32_t TriggerPolarity;
} I2C_AutonomousModeConfTypeDef;
|
hal_status_t HAL_I2C_AM_EnableTrigger(hal_i2c_handle_t *hi2c);
hal_status_t HAL_I2C_AM_DisableTrigger(hal_i2c_handle_t *hi2c);
typedef struct
{
hal_i2c_am_trigger_source_t source;
hal_i2c_am_trigger_polarity_t polarity;
} hal_i2c_am_trigger_config_t;
|
Related concepts:
HAL I2C callback type definition ¶
|
HAL1 |
HAL2 |
|---|---|
|
pI2C_CallbackTypeDef |
hal_i2c_cb_t |
|
pI2C_AddrCallbackTypeDef |
hal_i2c_slave_addr_cb_t |
Related concept: Replaced TypeDef suffix with _t in type names